<h3>Load vouchers</h3>
<? if (!$this->hideForm): ?>
<form class="form-horizontal" method="POST">
  <fieldset>
    <legend>Add new vouchers to the database</legend>
    <div class="control-group">
      <label class="control-label" for="separator">Separator</label>
      <div class="controls">
		<input type="text" id="separator" name="separator" value=";">
      </div>
    </div>
	<? for ($i=1; $i <= 7; $i++): ?>
    <div class="control-group">
      <label class="control-label" for="vouchers">Col <?= $i ?></label>
      <div class="controls">
	    <select name="col_<?= $i ?>">
		  <option <?= ($i == 1)?'selected':'' ?> value="voucher">Voucher Number</option>
		  <option <?= ($i == 2)?'selected':'' ?> value="exp_date">Expiration Date</option>
		  <option <?= ($i == 3)?'selected':'' ?> value="name">Name</option>
		  <option <?= ($i == 4)?'selected':'' ?> value="city">City</option>
		  <option <?= ($i == 5)?'selected':'' ?> value="state">State</option>
		  <option <?= ($i == 6)?'selected':'' ?> value="zip">Zip</option>
		  <option <?= ($i == 7)?'selected':'' ?> value="price">Price</option>
		</select>
      </div>
    </div>
	<? endfor; ?>
    <div class="control-group">
      <label class="control-label" for="vouchers">Vouchers</label>
      <div class="controls">
		<textarea name="vouchers" rows=5 style="Width:90%"></textarea><br>
		<span style="color:#AAA; font-size:11px;">
  		  <strong>Format:</strong> voucher number ; yyyy-mm-dd ; [psn|xbox]; details
		</span> 
      </div>
    </div>
    <div class="control-group">
      <div class="controls">
        <button type="submit" class="btn btn-success">Load vouchers</button>
      </div>
    </div>
  </fieldset>
</form>
<? endif; ?>
<? if (!$this->hideResult): ?>
<table class="table table-striped table-condensed table-hover">
  <tr>
	<th>Voucher Number</th>
	<th>Expires</th>
	<th>Type</th>
	<th>Details</th>
	<th style="width:30px;">Info</th>
  </tr>
  <? foreach ($this->vouchers as $voucher): ?>
    <tr>
      <td><?= $voucher['voucher'] ?></td>
      <td><?= $voucher['exp_date'] ?></td>
      <td><?= $voucher['type'] ?></td>
      <td><?= $voucher['details'] ?></td>
      <td>
        <? if ($voucher['exists']): ?>
		  <span class="label">Already exists</span>
        <? else: ?>
		  <span class="label label-success">New</span>
        <? endif; ?>
	  </td>
    </tr>
  <? endforeach; ?>
</table>
<form class="form-horizontal" method="POST">
	<input type="hidden" value="<?= base64_encode(serialize($this->vouchers)) ?>" name="serVouchers">
    <button type="submit" class="btn btn-success">Load vouchers</button>
</form>
<? endif; ?>
